import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {ShouldLoginComponent} from "./should-login.component";
import {FallbackComponent} from "./fallback/fallback.component";
import {RegisterComponent} from "./pages/register/register.component";

const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: 'basics/home' },
  { path: 'welcome', loadChildren: () => import('./pages/welcome/welcome.module').then(m => m.WelcomeModule) },
  { path: 'basics', loadChildren: () => import('./feature-basic/basics.module').then(m => m.BasicsModule) },
  { path: 'extras', loadChildren: () => import('./feature-extras/extras.module').then(m => m.ExtrasModule) },
  { path: 'should-login', component: ShouldLoginComponent },
  {path: 'register', component: RegisterComponent},
  { path: '**', component: FallbackComponent },
];

@NgModule({
  imports: [RouterModule.forRoot(routes,{
    // // 设置全局前缀
    // useHash: true,
    // // 添加前缀
    // preloadingStrategy: PreloadAllModules,
    // extraOptions: {
    //   // 这里设置你的全局前缀
    //   // 注意这里的配置取决于你的实际需求
    //   // 对于 http 前缀的添加可能需要服务器端的支持或者更复杂的配置
    //   // 这里仅作为示例展示如何设置全局路径前缀
    //   pathPrefix: '/prefix',
    //   anchorScrolling: 'enabled'
    // }
  })],
  exports: [RouterModule]
})
export class AppRoutingModule { }
